/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uvmanager;

import fr.insatoulouse.uvmanager.grb.DataBase.Manager;
import fr.insatoulouse.uvmanager.grb.uvmanager.*;
import java.util.ArrayList;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 *
 * @author Alexander Remen
 */
@WebService()
public class uvmanager  implements UVManager_PortType{
    
    Manager mg = new Manager();
    public int addUV(String name, String description, int year, int CM, int TD, int TP, int BE, int controle, String inCharge) throws java.rmi.RemoteException {
        int res = mg.addUV(name, description, year, CM, TD, TP, BE, controle, inCharge);
    	return res;
    }
    

    public void updateUV(int id, String name, String description, int year, int CM, int TD, int TP, int BE, int controle, String inCharge) throws java.rmi.RemoteException {    
    	mg.updateUV(id, name, description, year, CM, TD, TP, BE, controle, inCharge);
    }

    public void updateUVStatus(int id, UVStatus status) throws java.rmi.RemoteException {
    	mg.updateUVStatus(id, status.fromValue(status));
    }

    public int addAssignment(@WebParam(name = "UVId") int UVId, @WebParam(name = "teacher") String teacher, @WebParam(name = "amount") int amount, @WebParam(name = "type") LectureType type) {
        int res = mg.addAssignment(UVId, teacher, amount, type);
    	return res;
    }

    public void updateAssignment(@WebParam(name = "id") int id, @WebParam(name = "teacher") String teacher, @WebParam(name = "amount") int amount, @WebParam(name = "type") LectureType type) {
    mg.updateAssignment(id, teacher, amount, type);
    }

    public void updateAssignmentStatus(@WebParam(name = "id") int id, @WebParam(name = "status") AssignmentStatus status) {
    	mg.updateAssignmentStatus(id, status);
    }

    public void deleteUV(@WebParam(name = "id") int id) {
    	mg.deleteUV(id);
    }

    public void deleteAssignment(@WebParam(name = "id") int id) {
    	mg.deleteAssignment(id);
    }

    public int getUVId(@WebParam(name = "name") String name) {
        int res = mg.getUVId(name);
    	return res;
    }

    public UV getUV(@WebParam(name = "id") int id) {
        UV uv = mg.getUV(id);
    	return uv;
    }

    public ArrayList<UV> getPromo(@WebParam(name = "year") int year) {
        return mg.getPromo(year);
    }

    public Assignment getAssignment(@WebParam(name = "id") int id) {
        return mg.getAssignment(id);
    }

    public ArrayList<Assignment> getUVAssignments(@WebParam(name = "UVId") int id) {
        return mg.getUVAssignments(id);
    }
}
